import Vue from 'vue'
import { messageType, IMessage } from '.'

export function createIMessage(props: Omit<messageType, 'btn'>) {
    const div = document.createElement('div')
    document.body.appendChild(div)

    return new Vue({
        el: div,
        mounted() {
            ;(this.$refs.ModalGenerator as any).open()
        },
        render() {
            return <IMessage ref="ModalGenerator" {...{ props }} />
        }
    })
}
